<template>
  <div
    class="stepdevice"
    :style="{
      height: height,
      width: width,
    }"
  >
    <section @click="hander(-1)">-</section>
    <section>{{ num }}</section>
    <section @click="hander(1)">+</section>
  </div>
</template>

<script>
export default {
  name: "stepdevice",
  props: {
    count: {
      type: Number,
      default: 1,
    },
    height: {
      type: String,
      default: "1rem",
    },
    width: {
      type: String,
      default: "3rem",
    },
  },
  data() {
    return {
        num:0
    };
  },
  created() {
    this.num = this.count
  },
  methods: {
    hander(val) {
      if (this.num != 0 ) {
        this.num += parseInt(val);
      }else{
        if(val === 1){
            this.num += parseInt(val);
        }else{
            return
        }
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.stepdevice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  section {
    width: 30%;
    height: 100%;
    background-color: #f6f6f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.32rem;
  }
}
</style>
